package com.xjtu.backend.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xjtu.backend.result.Result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjtu.backend.mapper.*;
import com.xjtu.backend.entity.*;
import java.util.*;

@RestController
public class LoginController {
    @Autowired
    private OrgMapper orgMapper;
    @Autowired
    private SoliderMapper soliderMapper;
    @Autowired
    private StudentMapper studentMapper;

//    @PostMapping("/login")
//    public Result<Student> Login(LoginInfo log) {
//        String name = log.getUsername();
//        QueryWrapper wrapper = new QueryWrapper();
//        wrapper.eq("name", name);
//
//        wrapper.eq("org_name", org1.getOrg_name());
//        List<Org> list_org = orgMapper.selectList(wrapper);
//        if (list_org.size() != 0) {
//            return Result.error("it has been registered");
//        }
//
//        return ;
//    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    private static class LoginInfo {
        private String username;
        private String password;
    }

}

